/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Cali.java
 *
 * Created on 10-dic-2009, 18:52:06
 */
package GUI;

import Controlador.Controlador;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.Vector;

/**
 *
 * @author Administrador
 */
public class GUI_GrabarRuta extends javax.swing.JDialog {

    private static Controlador controlador;
    private String nombreRuta;
    private Vector rutaGrabada;

    /** Creates new form Cali */
    public GUI_GrabarRuta(GUI_Iconos parent, Controlador c) {
        super(parent, true);
        controlador = c;
        parent.setVisible(false);
        initComponents();
        centrarAplicacion();
        //parent.setDisplayMapa(this.PMapa);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        BGModoCalibracion = new javax.swing.ButtonGroup();
        DPMapa = new javax.swing.JDesktopPane();
        PMapa = new javax.swing.JPanel();
        JDPImagen = new javax.swing.JPanel();
        BCargar = new javax.swing.JButton();
        JDPImagen1 = new javax.swing.JPanel();
        BCargar1 = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Calibración de mapas");
        setResizable(false);

        DPMapa.setBackground(new java.awt.Color(235, 233, 237));
        DPMapa.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 153, 255), 3, true), "Mapa", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 14))); // NOI18N
        DPMapa.setForeground(new java.awt.Color(235, 233, 237));
        DPMapa.setPreferredSize(new java.awt.Dimension(650, 560));

        PMapa.setToolTipText("");
        PMapa.setName("Mapa"); // NOI18N
        PMapa.setPreferredSize(new java.awt.Dimension(633, 548));
        PMapa.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                PMapaMouseClicked(evt);
            }
        });
        PMapa.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                PMapaMouseMoved(evt);
            }
        });

        javax.swing.GroupLayout PMapaLayout = new javax.swing.GroupLayout(PMapa);
        PMapa.setLayout(PMapaLayout);
        PMapaLayout.setHorizontalGroup(
            PMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 630, Short.MAX_VALUE)
        );
        PMapaLayout.setVerticalGroup(
            PMapaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 490, Short.MAX_VALUE)
        );

        PMapa.setBounds(10, 20, 630, 490);
        DPMapa.add(PMapa, javax.swing.JLayeredPane.DEFAULT_LAYER);

        JDPImagen.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 153, 255), 3, true), "Imagen", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 14))); // NOI18N

        BCargar.setText("Cargar Imagen");
        BCargar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BCargarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout JDPImagenLayout = new javax.swing.GroupLayout(JDPImagen);
        JDPImagen.setLayout(JDPImagenLayout);
        JDPImagenLayout.setHorizontalGroup(
            JDPImagenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JDPImagenLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(BCargar, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(38, Short.MAX_VALUE))
        );
        JDPImagenLayout.setVerticalGroup(
            JDPImagenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JDPImagenLayout.createSequentialGroup()
                .addComponent(BCargar, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                .addContainerGap())
        );

        JDPImagen1.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 153, 255), 3, true), "Ruta", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 14))); // NOI18N

        BCargar1.setText("Iniciar Grabacion");
        BCargar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BCargar1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout JDPImagen1Layout = new javax.swing.GroupLayout(JDPImagen1);
        JDPImagen1.setLayout(JDPImagen1Layout);
        JDPImagen1Layout.setHorizontalGroup(
            JDPImagen1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JDPImagen1Layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addComponent(BCargar1, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(63, Short.MAX_VALUE))
        );
        JDPImagen1Layout.setVerticalGroup(
            JDPImagen1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JDPImagen1Layout.createSequentialGroup()
                .addComponent(BCargar1, javax.swing.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTextField1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextField1.setText("NombreRuta");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1016, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(JDPImagen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(JDPImagen1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(DPMapa, javax.swing.GroupLayout.PREFERRED_SIZE, 653, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(63, 63, 63)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(89, 89, 89))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 655, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(36, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(JDPImagen1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JDPImagen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(DPMapa, javax.swing.GroupLayout.PREFERRED_SIZE, 524, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(586, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void PMapaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PMapaMouseClicked

}//GEN-LAST:event_PMapaMouseClicked

    private void PMapaMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PMapaMouseMoved

}//GEN-LAST:event_PMapaMouseMoved

    private void BCargarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BCargarActionPerformed
        //controlador.calibracion();
}//GEN-LAST:event_BCargarActionPerformed

    private void BCargar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BCargar1ActionPerformed
        nombreRuta = jTextField1.getText();
        controlador.setModoGrabacion(true);
        //controlador.guardarRuta(nombreRuta,rutaGrabada);
}//GEN-LAST:event_BCargar1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BCargar;
    private javax.swing.JButton BCargar1;
    private javax.swing.ButtonGroup BGModoCalibracion;
    private javax.swing.JDesktopPane DPMapa;
    private javax.swing.JPanel JDPImagen;
    private javax.swing.JPanel JDPImagen1;
    private javax.swing.JPanel PMapa;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables

    private void centrarAplicacion() {
        int width = this.getWidth();
        int height = this.getHeight();
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (screen.width - width) / 2;
        int y = (screen.height - height) / 2;
        setBounds(x, y, width, height);
    }
}
